import { useUserStore } from "../stores/user.ts";

/**
 * 鉴权方法
 */
const checkRole = async (userRole: string, needRole: string) => {
  const store = useUserStore();
  if (!userRole || !store.id || store.id === 0) {
    return false;
  } else if (userRole === needRole) {
    return true;
  }
  return false;
};
export default checkRole;
